package com.example.mall.client.fallback;

import com.example.mall.client.OrderFeignClient;
import com.example.mall.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: xxxliu
 * @CreateTime: 2025-06-03
 * @Version: 1.0
 */
@Component
public class OrderFeignClientFactory implements FallbackFactory<OrderFeignClient> {

    @Override
    public OrderFeignClient create(Throwable throwable) {
        return new OrderFeignClient() {

            @Override
            public JSONResult selectByOrderNo(String orderNo) {
                return JSONResult.error("订单获取失败");
            }
        };
    }
}
